@echo off
echo === Building with Visual Studio 2022 ===

REM Setup VS2022 environment
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\VsDevCmd.bat" -arch=x64

cd /d D:\vc\devops-platform

REM Clean previous build
if exist build rmdir /s /q build
mkdir build
cd build

echo 1. Running CMake configuration...
cmake .. -G "Visual Studio 17 2022" -A x64

echo 2. Building project...
cmake --build . --config Release --parallel

if %errorlevel% equ 0 (
    echo [SUCCESS] Build completed! Executable: build/Release/devops-platform.exe
) else (
    echo [ERROR] Build failed!
    exit /b 1
)
